﻿using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using Volo.Abp;
using Business.WarehouseManagement;
using Business.WarehouseManagement.Dto;
using System;
using Volo.Abp.Application.Dtos;

namespace Business.Controllers
{
    /// <summary>
    /// 入库管理
    /// </summary>
    [RemoteService]
    [Area("Business")]
    [Route("api/business/Warehouse")]
    public class WarehouseController
    {

        private readonly IWarehouseAppService _warehouseAppService;

        public WarehouseController(IWarehouseAppService warehouseAppService)
        {
            _warehouseAppService=warehouseAppService;
        }

        /// <summary>
        /// 创建或更新入库
        /// </summary>
        /// <param name="input">入库信息</param>
        /// <returns></returns>
        [HttpPost]
        [Route("data-post")]
        public Task<AddWarehouseDto> CreateOrUpdate(AddWarehouseDto input) 
        {
            return _warehouseAppService.CreateOrUpdate(input);
        }



        /// <summary>
        /// 获取所有入库信息
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        [HttpGet]
        [Route("get-all")]
        public Task<PagedResultDto<AddWarehouseDto>> GetAll(GetWarehouseInputDto input)
        {
            return _warehouseAppService.GetAll(input);
        }

    }
}
